<?
session_start();
require_once("../config/dbconn.php");

//是否关闭了系统
if($glo_sysclose==1){
	die($glo_closememo);
}

if($act=='userlogin'){
	$msg='';
	if(trim($username)=='') $msg.="请输入用户名\\n";
	if(trim($password)=='') $msg.="请输入密码\\n";
	if(trim($verifycode)=='') $msg.="请输入验证码\\n";
	else{
		if ($_SESSION['lgnrandcode2']!=trim($verifycode))$msg.="验证码错误\\n";
	}
	if ($msg!=''){
		echo "<script>alert('$msg');history.back();</script>";exit();
	}
	$sql="select * from {$db_prefix}users where username='".trim($username)."'";
	$rs=$db->get_one($sql);
	if (!$rs['id']){
		$msg.="用户名或密码错误\\n";
	}else{
		if (authcode($rs['pwd'],"DECODE")!=$password) $msg.="用户名或密码错误\\n";
	}
	if ($msg!=''){
		echo "<script>alert('$msg');history.back();</script>";exit();
	}
	$_SESSION['sys_userid']=$rs['id'];$_SESSION['sys_username']=$rs['username'];
	
	echo "<script>location.href='index.php';</script>";exit();
}
?>
<html>
<head>
<title>会员登陆</title>
<style type="text/css">
.user_main_text{
	color:#FF0000
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (1登陆界面效果图(1366X768).psd) -->
<table id="__01" width="1366" height="768" border="0" cellpadding="0" cellspacing="0" align="center">
	<tr>
		<td background="images/login_01.jpg" width="1366" height="70">
			</td>
	</tr>
	<tr>
		<td background="images/login_02.jpg" width="1366" height="107">
			</td>
	</tr>
	<tr>
		<td background="images/login_03.jpg" width="1366" height="113">
			</td>
	</tr>
	<tr>
		<td background="images/login_04.jpg" width="1366" height="80">
			</td>
	</tr>
	<tr>
		<td background="images/login_05.jpg">
			</td>
	</tr>
	<tr>
		<td background="images/login_06.jpg" width="1366" height="215"><form name="form1" method="post" action="?act=userlogin">
		  <table width="100%" border="0">
            <tr>
              <td width="39%" align="right"><span class="user_main_text">用户名：</span></td>
              <td width="61%"><span class="user_main_input">
                <INPUT class=TxtUserNameCssClass id=username 
      maxLength=20 name=username>
              </span></td>
            </tr>
            <tr>
              <td align="right"><span class="user_main_text">密 码：</span></td>
              <td><span class="user_main_input">
                <INPUT class=TxtPasswordCssClass id=password 
      type=password name=password>
              </span></td>
            </tr>
            <tr>
              <td align="right"><span class="user_main_text">验证码： </span></td>
              <td><span class="user_main_input">
                <input class=TxtPasswordCssClass name=verifycode type=text value="" maxLength=4 size=10>
              </span>  <img style="cursor:pointer" title="刷新验证码" id="refresh2" border='0' src='lgncode1.php'
onclick="document.getElementById('refresh2').src='lgncode1.php?t='+Math.random()"/></td>
            </tr>
            <tr>
              <td align="right">&nbsp;</td>
              <td><input type="image" src="images/userlogin.png" width="52" height="23"></td>
            </tr>
          </table>
                </form>			</td>
	</tr>
	<tr>
		<td background="images/login_07.jpg" width="1366" height="117">
			</td>
	</tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>